package com.runen.infinitemovement.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.runen.infinitemovement.activity.SportsStatusActivity;


/**
 * Author: SXF
 * E-mail: xue.com.fei@outlook.com
 * CreatedTime: 2018/5/13 11:11
 * <p>
 * SportsActionReceiver
 */
public class SportsActionReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if ("ACTION_SPORTS_STATUS".equals(action)) {
            Intent status = new Intent(context, SportsStatusActivity.class);
            status.putExtra("SPORTS_TYPE",
                    intent.getStringExtra("SPORTS_TYPE"));
            status.putExtra("sportRecordId",
                    intent.getIntExtra("sportRecordId", 0));
            status.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(status);
        }
    }

}
